﻿using System.Web.Mvc;
using CRM.Database.Model;
using DevExpress.Web.Mvc;


namespace CRM.Controllers
{
    [Localize]
    public class DictionariesController : Controller
    {
        
        /// <summary>
        /// Текущий пользователь
        /// </summary>
        protected string CurrentUser
        {
            get { return Request.LogonUserIdentity.Name; }
        }

        public ActionResult Index()
        {
            return View();
        }

        #region OwnershipPatterns

        [CheckAccessAttribute]
        public ActionResult OwnershipPatterns()
        {
            var col = new OwnershipsPatternsCollection();
            return View(col.OwnershipsPatternsList);
        }

        public ActionResult OwnershipPatternsPartiotional()
        {
            var col = new OwnershipsPatternsCollection();
            return PartialView("OwnershipPatternsPartial", col.OwnershipsPatternsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult OwnershipPatternsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] OwnershipPatterns pattern)
        {
            var col = new OwnershipsPatternsCollection();
            if (ModelState.IsValid)
            {
               

                col.Update(pattern,Request.LogonUserIdentity.Name);

            }

            return PartialView("OwnershipPatternsPartial", col.OwnershipsPatternsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult OwnershipPatternsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] OwnershipPatterns pattern)
        {
            var col = new OwnershipsPatternsCollection();
            if (ModelState.IsValid)
            {
               
                col.Delete(pattern);
            }
            return PartialView("OwnershipPatternsPartial", col.OwnershipsPatternsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult OwnershipPatternsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] OwnershipPatterns pattern)
        {
            var col = new OwnershipsPatternsCollection();
            if (ModelState.IsValid)
            {
               

                col.Add(pattern,Request.LogonUserIdentity.Name);
            }

            return PartialView("OwnershipPatternsPartial", col.OwnershipsPatternsList);
        }

        #endregion
        
        //#region CustomerClassifications

        //[CheckAccessAttribute]
        //public ActionResult CustomerClassifications()
        //{
        //    return View(DB.CustomerClassifications);
        //}

        //public ActionResult CustomerClassificationsPartiotional()
        //{
        //    return PartialView("CustomerClassificationsPartial", DB.CustomerClassifications);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomerClassificationsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassifications classification)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        //foreach (var classif in Collection.CustomerClassifications)
        //        //{
        //        //    if (classif.IdCustomerClassification == classification.IdCustomerClassification)
        //        //    {
        //        //        classif.IsActive = classification.IsActive;
        //        //        classif.NameEn = classification.NameEn;
        //        //        classif.NameRu = classification.NameRu;
        //        //        classif.MaxRevenue = classification.MaxRevenue;
        //        //        classif.MinRevenue = classification.MinRevenue;
        //        //        break;
        //        //    }
        //        //}
        //        //Collection.SaveChanges();

        //        DB.CustomerClassificationsUpdate(classification);
        //    }
        //    return PartialView("CustomerClassificationsPartial", DB.CustomerClassifications);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomerClassificationsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassifications classification)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        //CustomerClassifications classi = null;
        //        //foreach (var classif in Collection.CustomerClassifications)
        //        //{
        //        //    if (classif.IdCustomerClassification == classification.IdCustomerClassification)
        //        //    {
        //        //        classi = classif;
        //        //        break;
        //        //    }
        //        //}

        //        //if (classi != null)
        //        //{
        //        //    Collection.CustomerClassifications.DeleteObject(classi);
        //        //}
        //        //Collection.SaveChanges();

        //        DB.CustomerClassificationsDelete(classification);
        //    }

        //    return PartialView("CustomerClassificationsPartial", DB.CustomerClassifications);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomerClassificationsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassifications classification)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        //Collection.CustomerClassifications.AddObject(classification);
        //        //Collection.SaveChanges();

        //        DB.CustomerClassificationsInsert(classification);
        //    }

        //    return PartialView("CustomerClassificationsPartial", DB.CustomerClassifications);
        //}
        

        //#endregion

        #region profineRegions - moved

        [CheckAccessAttribute]
        public ActionResult profineRegions()
        {
            var profineRegionsCol = new CRM.Database.Model.profineRegionsCollection();
            return View(profineRegionsCol.profineRegionsList);
            //return View(DB.profineRegions);
        }

        public ActionResult profineRegionsPartiotional()
        {
            var profineRegionsCol = new CRM.Database.Model.profineRegionsCollection();
            return PartialView("profineRegionsPartial", profineRegionsCol.profineRegionsList);
            //return PartialView("profineRegionsPartial", DB.profineRegions);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult profineRegionsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.profineRegions region)
        {
            var profineRegionsCol = new CRM.Database.Model.profineRegionsCollection();
            if (ModelState.IsValid)
            {
                if(!profineRegionsCol.Update(region, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.profineRegionsUpdate(region);
            }
            return PartialView("profineRegionsPartial", profineRegionsCol.profineRegionsList);
            //return PartialView("profineRegionsPartial", DB.profineRegions);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult profineRegionsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.profineRegions region)
        {
            var profineRegionsCol = new CRM.Database.Model.profineRegionsCollection();
            if (ModelState.IsValid)
            {
                if (!profineRegionsCol.Delete(region))
                    return RedirectToAction("Error", "Home");
                //DB.profineRegionsDelete(region);
            }
            return PartialView("profineRegionsPartial", profineRegionsCol.profineRegionsList);
            //return PartialView("profineRegionsPartial", DB.profineRegions);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult profineRegionsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.profineRegions region)
        {
            var profineRegionsCol = new CRM.Database.Model.profineRegionsCollection();
            if (ModelState.IsValid)
            {
                if (!profineRegionsCol.Add(region, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.profineRegionsInsert(region);
            }
            return PartialView("profineRegionsPartial", profineRegionsCol.profineRegionsList);
            //return PartialView("profineRegionsPartial", DB.profineRegions);
        }

        #endregion

        #region Colors - moved

        [CheckAccessAttribute]
        public ActionResult Colors()
        {
            var colorsCol = new CRM.Database.Model.ColorsCollection();
            return View(colorsCol.ColorsList);
            //return View(DB.Colors);
        }
        
        public ActionResult ColorsPartial()
        {
            var colorsCol = new CRM.Database.Model.ColorsCollection();
            return PartialView("ColorsPartial", colorsCol.ColorsList);
            //return PartialView("ColorsPartial", DB.Colors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ColorsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Colors colour)
        {
            var colorsCol = new CRM.Database.Model.ColorsCollection();
            if (ModelState.IsValid)
            {
                colorsCol.Update(colour, Request.LogonUserIdentity.Name);
                //DB.ColorsUpdate(colour);
            }
            return PartialView("ColorsPartial", colorsCol.ColorsList);
            //return PartialView("ColorsPartial", DB.Colors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ColorsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Colors colour)
        {
            var colorsCol = new CRM.Database.Model.ColorsCollection();
            if (ModelState.IsValid)
            {
                colorsCol.Delete(colour);
                //DB.ColorsDelete(colour);
            }
            return PartialView("ColorsPartial", colorsCol.ColorsList);
            //return PartialView("ColorsPartial", DB.Colors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ColorsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Colors colour)
        {
            var colorsCol = new CRM.Database.Model.ColorsCollection();
            if (ModelState.IsValid)
            {
                colorsCol.Add(colour, Request.LogonUserIdentity.Name);
                //DB.ColorsInsert(colour);
            }
            return PartialView("ColorsPartial", colorsCol.ColorsList);
            //return PartialView("ColorsPartial", DB.Colors);
        }

        #endregion

        #region Geometries - moved

        [CheckAccessAttribute]
        public ActionResult Geometries()
        {
            var col = new GeometriesCollection();
            return View(col.GeometriesList);
        }

        public ActionResult GeometriesPartial()
        {
            var col = new GeometriesCollection();
            return PartialView("GeometriesPartial",col.GeometriesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult GeometriesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Geometries geometries)
        {
            var col = new GeometriesCollection();
            if (ModelState.IsValid)
            {
                col.Update(geometries, Request.LogonUserIdentity.Name);
            }

            return PartialView("GeometriesPartial", col.GeometriesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult GeometriesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Geometries geometries)
        {
            var col = new GeometriesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(geometries);
            }

            return PartialView("GeometriesPartial", col.GeometriesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult GeometriesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Geometries geometries)
        {
            var col = new GeometriesCollection();
            if (ModelState.IsValid)
            {
                col.Add(geometries, Request.LogonUserIdentity.Name);
            }

            return PartialView("GeometriesPartial", col.GeometriesList);
        }
        
        #endregion
        
        #region Products - moved

        [CheckAccessAttribute]
        public ActionResult Products()
        {
            var productsCol = new CRM.Database.Model.ProductsCollection();
            return View(productsCol.ProductsList);
            //return View(DB.Products);
        }

        public ActionResult ProductsPartial()
        {
            var productsCol = new CRM.Database.Model.ProductsCollection();
            return PartialView("ProductsPartial", productsCol.ProductsList);
            //return PartialView("ProductsPartial", DB.Products);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Products product)
        {
            var productsCol = new CRM.Database.Model.ProductsCollection();
            if (ModelState.IsValid)
            {
                productsCol.Update(product, Request.LogonUserIdentity.Name);
                //DB.ProductsUpdate(product);
            }
            return PartialView("ProductsPartial", productsCol.ProductsList);
            //return PartialView("ProductsPartial", DB.Products);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Products product)
        {
            var productsCol = new CRM.Database.Model.ProductsCollection();
            if (ModelState.IsValid)
            {
                productsCol.Delete(product);
                //DB.ProductsDelete(product);
            }
            return PartialView("ProductsPartial", productsCol.ProductsList);
            //return PartialView("ProductsPartial", DB.Products);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Products product)
        {
            var productsCol = new CRM.Database.Model.ProductsCollection();
            if (ModelState.IsValid)
            {
                productsCol.Add(product, Request.LogonUserIdentity.Name);
                //DB.ProductsInsert(product);
            }
            return PartialView("ProductsPartial", productsCol.ProductsList);
            //return PartialView("ProductsPartial", DB.Products);
        }


        #endregion

        //#region Organisations

        //[CheckAccessAttribute]
        //public ActionResult Organisations()
        //{
        //    return View(DB.Organisations);
        //    //return View(DB.Organisations);
        //}

        //public ActionResult OrganisationsPartial()
        //{
        //    return PartialView("OrganisationsPartial", DB.Organisations);
        //    //return PartialView("OrganisationsPartial", DB.Organisations);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult OrganisationsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Organisations organisation)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.OrganisationsUpdate(organisation);
        //    }
        //    return PartialView("OrganisationsPartial", DB.Organisations);
        //    //return PartialView("OrganisationsPartial", DB.Organisations);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult OrganisationsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] Organisations organisation)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.OrganisationsDelete((organisation));
        //    }
        //    return PartialView("OrganisationsPartial", DB.Organisations);
        //    //return PartialView("OrganisationsPartial", DB.Organisations);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult OrganisationsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] Organisations organisation)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.OrganisationsInsert(organisation);
        //    }
        //    return PartialView("OrganisationsPartial", DB.Organisations);
        //    //return PartialView("OrganisationsPartial", DB.Organisations);
        //}

        //#endregion

        #region ProductGroups - moved

        [CheckAccessAttribute]
        public ActionResult ProductGroups()
        {
            var productsGroupCol = new CRM.Database.Model.ProductGroupsCollection();
            return View(productsGroupCol.ProductGroupsList);
            //return View(DB.ProductGroups);
        }

        public ActionResult ProductGroupsPartial()
        {
            var productsGroupCol = new CRM.Database.Model.ProductGroupsCollection();
            return PartialView("ProductGroupsPartial", productsGroupCol.ProductGroupsList);
            //return PartialView("ProductGroupsPartial", DB.ProductGroups);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductGroupsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductGroups product)
        {
            var productsGroupCol = new CRM.Database.Model.ProductGroupsCollection();
            if (ModelState.IsValid)
            {
                //foreach (var prod in Collection.ProductGroups)
                //{
                //    if (prod.IdProductGroup == product.IdProductGroup)
                //    {
                //        prod.GroupNameEn = product.GroupNameEn;
                //        prod.IsActive = product.IsActive;
                //        prod.GroupNameRu = product.GroupNameRu;
                //        prod.DescriptionEn = product.DescriptionEn;
                //        prod.DescriptionGer = product.DescriptionGer;
                //        prod.DescriptionRu = product.DescriptionRu;
                //        break;
                //    }
                //}
                //Collection.SaveChanges();
                productsGroupCol.Update(product, Request.LogonUserIdentity.Name);
                //DB.ProductGroupsUpdate(product);
            }
            return PartialView("ProductGroupsPartial", productsGroupCol.ProductGroupsList);
            //return PartialView("ProductGroupsPartial", DB.ProductGroups);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductGroupsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductGroups product)
        {
            var productsGroupCol = new CRM.Database.Model.ProductGroupsCollection();
            if (ModelState.IsValid)
            {
               // ProductGroups pro = null;
               // foreach (var prod in Collection.ProductGroups)
               // {
               //     if (prod.IdProductGroup == product.IdProductGroup)
               //     {
               //         pro = prod;
               //         break;
               //     }
               // }
               // if (pro != null)
               // {
               //     Collection.ProductGroups.DeleteObject(pro);
               // }
               //Collection.SaveChanges();
                productsGroupCol.Delete(product);
                //DB.ProductGroupsDelete(product);
            }
            return PartialView("ProductGroupsPartial", productsGroupCol.ProductGroupsList);
            //return PartialView("ProductGroupsPartial", DB.ProductGroups);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductGroupsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductGroups product)
        {
            var productsGroupCol = new CRM.Database.Model.ProductGroupsCollection();
            if (ModelState.IsValid)
            {
                //Collection.ProductGroups.AddObject(product);
                //Collection.SaveChanges();
                productsGroupCol.Add(product, Request.LogonUserIdentity.Name);
                //DB.ProductGroupsInsert(product);
            }
            return PartialView("ProductGroupsPartial", productsGroupCol.ProductGroupsList);
            //return PartialView("ProductGroupsPartial", DB.ProductGroups);
        }
        #endregion

        #region Areas - moved

        [CheckAccessAttribute]
        public ActionResult Areas()
        {
            var areasCol = new CRM.Database.Model.AreasCollection();
            return View(areasCol.AreasList);
            //return View(DB.Areas);
        }

        public ActionResult AreasPartial()
        {
            var areasCol = new CRM.Database.Model.AreasCollection();
            return PartialView("AreasPartial", areasCol.AreasList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult AreasPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Areas area)
        {
            var areasCol = new CRM.Database.Model.AreasCollection();
            if (ModelState.IsValid)
            {
                if (!areasCol.Update(area, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.AreasUpdate(area);
            }
            return PartialView("AreasPartial", areasCol.AreasList);
            //return PartialView("AreasPartial", DB.Areas);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult AreasPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Areas area)
        {
            var areasCol = new CRM.Database.Model.AreasCollection();
            if (ModelState.IsValid)
            {
                if (!areasCol.Delete(area))
                    return RedirectToAction("Error", "Home");
                //DB.AreasDelete(area);
            }
            return PartialView("AreasPartial", areasCol.AreasList);
            //return PartialView("AreasPartial", DB.Areas);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult AreasPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Areas area)
        {
            var areasCol = new CRM.Database.Model.AreasCollection();
            if (ModelState.IsValid)
            {
                if (!areasCol.Add(area, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.AreasInsert(area);
            }
            return PartialView("AreasPartial", areasCol.AreasList);
            //return PartialView("AreasPartial", DB.Areas);
        }

        #endregion

        #region Districts - moved

        [CheckAccessAttribute]
        public ActionResult Districts()
        {
            var districtsCol = new CRM.Database.Model.DistrictsCollection();
            return View(districtsCol.DistrictsList);
            //return View(DB.Districts);
        }

        public ActionResult DistrictsPartial()
        {
            var districtsCol = new CRM.Database.Model.DistrictsCollection();
            return PartialView("DistrictsPartial", districtsCol.DistrictsList);
            //return PartialView("DistrictsPartial", DB.Districts);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult DistrictsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Districts district)
        {
            var districtsCol = new CRM.Database.Model.DistrictsCollection();
            if (ModelState.IsValid)
            {
                if(!districtsCol.Update(district, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.DistrictsUpdate(district);
            }
            return PartialView("DistrictsPartial", districtsCol.DistrictsList);
            //return PartialView("DistrictsPartial", DB.Districts);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult DistrictsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Districts district)
        {
            var districtsCol = new CRM.Database.Model.DistrictsCollection();
            if (ModelState.IsValid)
            {
                if (!districtsCol.Delete(district))
                    return RedirectToAction("Error", "Home");
                //DB.DistrictsDelete(district);
            }
            return PartialView("DistrictsPartial", districtsCol.DistrictsList);
            //return PartialView("DistrictsPartial", DB.Districts);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult DistrictsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Districts district)
        {
            var districtsCol = new CRM.Database.Model.DistrictsCollection();
            if (ModelState.IsValid)
            {
                if (!districtsCol.Add(district, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.DistrictsInsert(district);
            }
            return PartialView("DistrictsPartial", districtsCol.DistrictsList);
            //return PartialView("DistrictsPartial", DB.Districts);
        }

        #endregion

        #region Regions - moved

        [CheckAccessAttribute]
        public ActionResult Regions()
        {
            var regionsCol = new CRM.Database.Model.RegionsCollection();
            return View(regionsCol.RegionsList);
            //return View(DB.Regions);
        }

        public ActionResult RegionsPartial()
        {
            var regionsCol = new CRM.Database.Model.RegionsCollection();
            return PartialView("RegionsPartial", regionsCol.RegionsList);
            //return PartialView("RegionsPartial", DB.Regions);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RegionsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Regions region)
        {
            var regionsCol = new CRM.Database.Model.RegionsCollection();
            if (ModelState.IsValid)
            {
                if(!regionsCol.Update(region, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.RegionsUpdate(region);
            }
            return PartialView("RegionsPartial", regionsCol.RegionsList);
            //return PartialView("RegionsPartial", DB.Regions);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RegionsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Regions region)
        {
            var regionsCol = new CRM.Database.Model.RegionsCollection();
            if (ModelState.IsValid)
            {
                if (!regionsCol.Delete(region))
                    return RedirectToAction("Error", "Home");
                //DB.RegionsDelete(region);
            }
            return PartialView("RegionsPartial", regionsCol.RegionsList);
            //return PartialView("RegionsPartial", DB.Regions);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RegionsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Regions region)
        {
            var regionsCol = new CRM.Database.Model.RegionsCollection();
            if (ModelState.IsValid)
            {
                if (!regionsCol.Add(region, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.RegionsInsert(region);
            }
            return PartialView("RegionsPartial", regionsCol.RegionsList);
            //return PartialView("RegionsPartial", DB.Regions);
        }

        #endregion

        #region Settlements - moved

        [CheckAccessAttribute]
        public ActionResult Settlements()
        {
            var settlementsCol = new CRM.Database.Model.SettlementsCollection();
            return View(settlementsCol.SettlementsList);
            //return View(col.SettlementsList);
        }

        public ActionResult SettlementsPartial()
        {
            var settlementsCol = new CRM.Database.Model.SettlementsCollection();
            return PartialView("SettlementsPartial", settlementsCol.SettlementsList);
            //return PartialView("SettlementsPartial", col.SettlementsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult SettlementsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Settlements settlement)
        {
            var settlementsCol = new CRM.Database.Model.SettlementsCollection();
            if (ModelState.IsValid)
            {
                //DB.SettlementsUpdate(settlement);
            }
            return PartialView("SettlementsPartial", settlementsCol.SettlementsList);
            //return PartialView("SettlementsPartial", DB.Settlements);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult SettlementsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Settlements settlement)
        {
            var settlementsCol = new CRM.Database.Model.SettlementsCollection();
            if (ModelState.IsValid)
            {
                //DB.SettlementsDelete(settlement);
            }
            return PartialView("SettlementsPartial", settlementsCol.SettlementsList);
            //return PartialView("SettlementsPartial", DB.Settlements);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult SettlementsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Settlements settlement)
        {
            var settlementsCol = new CRM.Database.Model.SettlementsCollection();
            if (ModelState.IsValid)
            {
                //DB.SettlementsInsert(settlement);
            }
            return PartialView("SettlementsPartial", settlementsCol.SettlementsList);
            //return PartialView("SettlementsPartial", DB.Settlements);
        }

        #endregion

        #region Countries - moved

        [CheckAccessAttribute]
        public ActionResult Countries()
        {
            var countriesCol = new CRM.Database.Model.CountriesCollection();
            return View(countriesCol.CountriesList);
            //return View(DB.Countries);
        }

        public ActionResult CountriesPartial()
        {
            var countriesCol = new CRM.Database.Model.CountriesCollection();
            return PartialView("CountriesPartial", countriesCol.CountriesList);
            //return PartialView("CountriesPartial", DB.Countries);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CountriesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Countries country)
        {
            var countriesCol = new CRM.Database.Model.CountriesCollection();
            if (ModelState.IsValid)
            {
                if (!countriesCol.Update(country, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.CountriesUpdate(country);
            }
            return PartialView("CountriesPartial", countriesCol.CountriesList);
            //return PartialView("CountriesPartial", DB.Countries);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CountriesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Countries country)
        {
            var countriesCol = new CRM.Database.Model.CountriesCollection();
            if (ModelState.IsValid)
            {
                if (!countriesCol.Delete(country))
                    return RedirectToAction("Error", "Home");
                //DB.CountriesDelete(country);
            }
            return PartialView("CountriesPartial", countriesCol.CountriesList);
            //return PartialView("CountriesPartial", DB.Countries);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CountriesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Countries country)
        {
            var countriesCol = new CRM.Database.Model.CountriesCollection();
            if (ModelState.IsValid)
            {
                if (!countriesCol.Add(country, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
                //DB.CountriesInsert(country);
            }
            return PartialView("CountriesPartial", countriesCol.CountriesList);
            //return PartialView("CountriesPartial", DB.Countries);
        }

        #endregion

        #region ProductVendors - moved

        [CheckAccessAttribute]
        public ActionResult ProductVendors()
        {
            var productsVendorsCol = new CRM.Database.Model.ProductVendorsCollection();
            return View(productsVendorsCol.ProductVendorsList);
            //return View(DB.ProductVendors);
        }

        public ActionResult ProductVendorsPartial()
        {
            var productsVendorsCol = new CRM.Database.Model.ProductVendorsCollection();
            return PartialView("ProductVendorsPartial", productsVendorsCol.ProductVendorsList);
            //return PartialView("ProductVendorsPartial", DB.ProductVendors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductVendorsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductVendors productVendorItem)
        {
            var productsVendorsCol = new CRM.Database.Model.ProductVendorsCollection();
            if (ModelState.IsValid)
            {
                productsVendorsCol.Update(productVendorItem, Request.LogonUserIdentity.Name);
                //DB.ProductVendorsUpdate(productVendorItem);
            }
            return PartialView("ProductVendorsPartial", productsVendorsCol.ProductVendorsList);
            //return PartialView("ProductVendorsPartial", DB.ProductVendors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductVendorsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductVendors productVendorItem)
        {
            var productsVendorsCol = new CRM.Database.Model.ProductVendorsCollection();
            if (ModelState.IsValid)
            {
                productsVendorsCol.Delete(productVendorItem);
                //DB.ProductVendorsDelete(productVendorItem);
            }
            return PartialView("ProductVendorsPartial", productsVendorsCol.ProductVendorsList);
            //return PartialView("ProductVendorsPartial", DB.ProductVendors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductVendorsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductVendors productVendorItem)
        {
            var productsVendorsCol = new CRM.Database.Model.ProductVendorsCollection();
            if (ModelState.IsValid)
            {
                productsVendorsCol.Add(productVendorItem, Request.LogonUserIdentity.Name);
                //DB.ProductVendorsInsert(productVendorItem);
            }
            return PartialView("ProductVendorsPartial", productsVendorsCol.ProductVendorsList);
            //return PartialView("ProductVendorsPartial", DB.ProductVendors);
        }
        
        #endregion

        #region ProductSystems - moved

        [CheckAccessAttribute]
        public ActionResult ProductSystems()
        {
            var productSystemsCol = new CRM.Database.Model.ProductSystemsCollection();
            return View(productSystemsCol.ProductSystemsList);
            //return View(DB.ProductSystems);
        }

        public ActionResult ProductSystemsPartial()
        {
            var productSystemsCol = new CRM.Database.Model.ProductSystemsCollection();
            return PartialView("ProductSystemsPartial", productSystemsCol.ProductSystemsList);
            //return PartialView("ProductSystemsPartial", DB.ProductSystems);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductSystemsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductSystems productSystemItem)
        {
            var productSystemsCol = new CRM.Database.Model.ProductSystemsCollection();
            if (ModelState.IsValid)
            {
                productSystemsCol.Update(productSystemItem, Request.LogonUserIdentity.Name);
                //DB.ProductSystemsUpdate(productSystemItem);
            }
            return PartialView("ProductSystemsPartial", productSystemsCol.ProductSystemsList);
            //return PartialView("ProductSystemsPartial", DB.ProductSystems);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductSystemsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductSystems productSystemItem)
        {
            var productSystemsCol = new CRM.Database.Model.ProductSystemsCollection();
            if (ModelState.IsValid)
            {
                productSystemsCol.Delete(productSystemItem);
                //DB.ProductSystemsDelete(productSystemItem);
            }
            return PartialView("ProductSystemsPartial", productSystemsCol.ProductSystemsList);
            //return PartialView("ProductSystemsPartial", DB.ProductSystems);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductSystemsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductSystems productSystemItem)
        {
            var productSystemsCol = new CRM.Database.Model.ProductSystemsCollection();
            if (ModelState.IsValid)
            {
                productSystemsCol.Add(productSystemItem, Request.LogonUserIdentity.Name);
                //DB.ProductSystemsInsert(productSystemItem);
            }
            return PartialView("ProductSystemsPartial", productSystemsCol.ProductSystemsList);
            //return PartialView("ProductSystemsPartial", DB.ProductSystems);
        }

        #endregion

        #region ProductMarks - moved

        [CheckAccessAttribute]
        public ActionResult ProductMarks()
        {
            var productMarksCol = new CRM.Database.Model.ProductMarksCollection();
            return View(productMarksCol.ProductMarksList);
            //return View(DB.ProductMarks);
        }

        public ActionResult ProductMarksPartial()
        {
            var productMarksCol = new CRM.Database.Model.ProductMarksCollection();
            return PartialView("ProductMarksPartial", productMarksCol.ProductMarksList);
            //return PartialView("ProductMarksPartial", DB.ProductMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductMarksPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductMarks productMarkItem)
        {
            var productMarksCol = new CRM.Database.Model.ProductMarksCollection();
            if (ModelState.IsValid)
            {
                productMarksCol.Update(productMarkItem, Request.LogonUserIdentity.Name);
                //DB.ProductMarksUpdate(productMarkItem);
            }
            return PartialView("ProductMarksPartial", productMarksCol.ProductMarksList);
            //return PartialView("ProductMarksPartial", DB.ProductMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductMarksPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductMarks productMarkItem)
        {
            var productMarksCol = new CRM.Database.Model.ProductMarksCollection();
            if (ModelState.IsValid)
            {
                productMarksCol.Delete(productMarkItem);
                //DB.ProductMarksDelete(productMarkItem);
            }
            return PartialView("ProductMarksPartial", productMarksCol.ProductMarksList);
            //return PartialView("ProductMarksPartial", DB.ProductMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProductMarksPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProductMarks productMarkItem)
        {
            var productMarksCol = new CRM.Database.Model.ProductMarksCollection();
            if (ModelState.IsValid)
            {
                productMarksCol.Add(productMarkItem, Request.LogonUserIdentity.Name);
                //DB.ProductMarksInsert(productMarkItem);
            }
            return PartialView("ProductMarksPartial", productMarksCol.ProductMarksList);
            //return PartialView("ProductMarksPartial", DB.ProductMarks);
        }

        #endregion

        //#region Tools

        //[CheckAccessAttribute]
        //public ActionResult Tools()
        //{
        //    var toolsCol = new CRM.Database.Model.ToolsCollection();
        //    return View(toolsCol.ToolsList);
        //    //return View(DB.Tools);
        //}

        //public ActionResult ToolsPartial()
        //{
        //    var toolsCol = new CRM.Database.Model.ToolsCollection();
        //    return PartialView("ToolsPartial", toolsCol.ToolsList);
        //    //return PartialView("ToolsPartial", DB.Tools);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ToolsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Tools toolItem)
        //{
        //    var toolsCol = new CRM.Database.Model.ToolsCollection();
        //    if (ModelState.IsValid)
        //    {
        //        toolsCol.Update(toolItem, Request.LogonUserIdentity.Name);
        //        //DB.ToolsUpdate(toolItem);
        //    }
        //    return PartialView("ToolsPartial", toolsCol.ToolsList);
        //    //return PartialView("ToolsPartial", DB.Tools);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ToolsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Tools toolItem)
        //{
        //    var toolsCol = new CRM.Database.Model.ToolsCollection();
        //    if (ModelState.IsValid)
        //    {
        //        toolsCol.Delete(toolItem);
        //        //DB.ToolsDelete(toolItem);
        //    }
        //    return PartialView("ToolsPartial", toolsCol.ToolsList);
        //    //return PartialView("ToolsPartial", DB.Tools);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ToolsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Tools toolItem)
        //{
        //    var toolsCol = new CRM.Database.Model.ToolsCollection();
        //    if (ModelState.IsValid)
        //    {
        //        toolsCol.Add(toolItem, Request.LogonUserIdentity.Name);
        //        //DB.ToolsInsert(toolItem);
        //    }
        //    return PartialView("ToolsPartial", toolsCol.ToolsList);
        //    //return PartialView("ToolsPartial", DB.Tools);
        //}
        
        //#endregion

        #region Equipments - moved

        [CheckAccessAttribute]
        public ActionResult Equipments()
        {
            var equipmentsCol = new CRM.Database.Model.EquipmentsCollection();
            return View(equipmentsCol.EquipmentsList);
            //return View(DB.Equipments);
        }

        public ActionResult EquipmentsPartial()
        {
            var equipmentsCol = new CRM.Database.Model.EquipmentsCollection();
            return PartialView("EquipmentsPartial", equipmentsCol.EquipmentsList);
            //return PartialView("EquipmentsPartial", DB.Equipments);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult EquipmentsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Equipments equipmentItem)
        {
            var equipmentsCol = new CRM.Database.Model.EquipmentsCollection();
            if (ModelState.IsValid)
            {
                equipmentsCol.Update(equipmentItem, Request.LogonUserIdentity.Name);
                //DB.EquipmentsUpdate(equipmentItem);
            }
            return PartialView("EquipmentsPartial", equipmentsCol.EquipmentsList);
            //return PartialView("EquipmentsPartial", DB.Equipments);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult EquipmentsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Equipments equipmentItem)
        {
            var equipmentsCol = new CRM.Database.Model.EquipmentsCollection();
            if (ModelState.IsValid)
            {
                equipmentsCol.Delete(equipmentItem);
                //DB.EquipmentsDelete(equipmentItem);
            }
            return PartialView("EquipmentsPartial", equipmentsCol.EquipmentsList);
            //return PartialView("EquipmentsPartial", DB.Equipments);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult EquipmentsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Equipments equipmentItem)
        {
            var equipmentsCol = new CRM.Database.Model.EquipmentsCollection();
            if (ModelState.IsValid)
            {
                equipmentsCol.Add(equipmentItem, Request.LogonUserIdentity.Name);
                //DB.EquipmentsInsert(equipmentItem);
            }
            return PartialView("EquipmentsPartial", equipmentsCol.EquipmentsList);
            //return PartialView("EquipmentsPartial", DB.Equipments);
        }
        
        #endregion

        //#region ToolVendors

        //[CheckAccessAttribute]
        //public ActionResult ToolVendors()
        //{
        //    return View(DB.ToolVendors);
        //}

        //public ActionResult ToolVendorsPartial()
        //{
        //    return PartialView("ToolVendorsPartial", DB.ToolVendors);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ToolVendorsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ToolVendors toolVendorItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ToolVendorsUpdate(toolVendorItem);
        //    }
        //    return PartialView("ToolVendorsPartial", DB.ToolVendors);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ToolVendorsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ToolVendors toolVendorItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ToolVendorsDelete(toolVendorItem);
        //    }
        //    return PartialView("ToolVendorsPartial", DB.ToolVendors);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ToolVendorsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ToolVendors toolVendorItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ToolVendorsInsert(toolVendorItem);
        //    }
        //    return PartialView("ToolVendorsPartial", DB.ToolVendors);
        //}

        //#endregion

        #region ToolGroups - moved

        [CheckAccessAttribute]
        public ActionResult ToolGroups()
        {
            var toolsGoupsCol = new CRM.Database.Model.ToolGroupsCollection();
            return View(toolsGoupsCol.ToolGroupsList);
            //return View(DB.ToolGroups);
        }

        public ActionResult ToolGroupsPartial()
        {
            var toolsGoupsCol = new CRM.Database.Model.ToolGroupsCollection();
            return PartialView("ToolGroupsPartial", toolsGoupsCol.ToolGroupsList);
            //return PartialView("ToolGroupsPartial", DB.ToolGroups);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ToolGroupsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ToolGroups toolGroupItem)
        {
            var toolsGoupsCol = new CRM.Database.Model.ToolGroupsCollection();
            if (ModelState.IsValid)
            {
                toolsGoupsCol.Update(toolGroupItem, Request.LogonUserIdentity.Name);
                //DB.ToolGroupsUpdate(toolGroupItem);
            }
            return PartialView("ToolGroupsPartial", toolsGoupsCol.ToolGroupsList);
            //return PartialView("ToolGroupsPartial", DB.ToolGroups);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ToolGroupsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ToolGroups toolGroupItem)
        {
            var toolsGoupsCol = new CRM.Database.Model.ToolGroupsCollection();
            if (ModelState.IsValid)
            {
                toolsGoupsCol.Delete(toolGroupItem);
                //DB.ToolGroupsDelete(toolGroupItem);
            }
            return PartialView("ToolGroupsPartial", toolsGoupsCol.ToolGroupsList);
            //return PartialView("ToolGroupsPartial", DB.ToolGroups);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ToolGroupsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ToolGroups toolGroupItem)
        {
            var toolsGoupsCol = new CRM.Database.Model.ToolGroupsCollection();
            if (ModelState.IsValid)
            {
                toolsGoupsCol.Add(toolGroupItem, Request.LogonUserIdentity.Name);
                //DB.ToolGroupsInsert(toolGroupItem);
            }
            return PartialView("ToolGroupsPartial", toolsGoupsCol.ToolGroupsList);
            //return PartialView("ToolGroupsPartial", DB.ToolGroups);
        }

        #endregion

        #region EquipmentTypes - moved

        [CheckAccessAttribute]
        public ActionResult EquipmentTypes()
        {
            var equipmentTypesCol = new CRM.Database.Model.EquipmentTypesCollection();
            return View(equipmentTypesCol.EquipmentTypesList);
            //return View(DB.EquipmentTypes);
        }

        public ActionResult EquipmentTypesPartial()
        {
            var equipmentTypesCol = new CRM.Database.Model.EquipmentTypesCollection();
            return PartialView("EquipmentTypesPartial", equipmentTypesCol.EquipmentTypesList);
            //return PartialView("EquipmentTypesPartial", DB.EquipmentTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult EquipmentTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.EquipmentTypes equipmentTypeItem)
        {
            var equipmentTypesCol = new CRM.Database.Model.EquipmentTypesCollection();
            if (ModelState.IsValid)
            {
                equipmentTypesCol.Update(equipmentTypeItem, Request.LogonUserIdentity.Name);
                //DB.EquipmentTypesUpdate(equipmentTypeItem);
            }
            return PartialView("EquipmentTypesPartial", equipmentTypesCol.EquipmentTypesList);
            //return PartialView("EquipmentTypesPartial", DB.EquipmentTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult EquipmentTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.EquipmentTypes equipmentTypeItem)
        {
            var equipmentTypesCol = new CRM.Database.Model.EquipmentTypesCollection();
            if (ModelState.IsValid)
            {
                equipmentTypesCol.Delete(equipmentTypeItem);
                //DB.EquipmentTypesDelete(equipmentTypeItem);
            }
            return PartialView("EquipmentTypesPartial", equipmentTypesCol.EquipmentTypesList);
            //return PartialView("EquipmentTypesPartial", DB.EquipmentTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult EquipmentTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.EquipmentTypes equipmentTypeItem)
        {
            var equipmentTypesCol = new CRM.Database.Model.EquipmentTypesCollection();
            if (ModelState.IsValid)
            {
                equipmentTypesCol.Add(equipmentTypeItem, Request.LogonUserIdentity.Name);
                //DB.EquipmentTypesInsert(equipmentTypeItem);
            }
            return PartialView("EquipmentTypesPartial", equipmentTypesCol.EquipmentTypesList);
            //return PartialView("EquipmentTypesPartial", DB.EquipmentTypes);
        }
        
        #endregion

        #region CustomerClassificationsProfine

        [CheckAccessAttribute]
        public ActionResult CustomerClassificationsProfine()
        {
            var col = new CustomerClassificationsProfineCollection();
            return View(col.CustomerClassificationsProfineList);
        }

        public ActionResult CustomerClassificationsProfinePartial()
        {
            var col = new CustomerClassificationsProfineCollection();
            return PartialView("CustomerClassificationsProfinePartial", col.CustomerClassificationsProfineList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsProfinePartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsProfine customerClassificationsProfineItem)
        {
            var col = new CustomerClassificationsProfineCollection();
            if (ModelState.IsValid)
            {
                col.Update(customerClassificationsProfineItem, Request.LogonUserIdentity.Name);
                
            }
            return PartialView("CustomerClassificationsProfinePartial", col.CustomerClassificationsProfineList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsProfinePartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsProfine customerClassificationsProfineItem)
        {
            var col = new CustomerClassificationsProfineCollection();
            if (ModelState.IsValid)
            {
                col.Delete(customerClassificationsProfineItem);
            }
            return PartialView("CustomerClassificationsProfinePartial", col.CustomerClassificationsProfineList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsProfinePartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsProfine customerClassificationsProfineItem)
        {
            var col = new CustomerClassificationsProfineCollection();
            if (ModelState.IsValid)
            {
                col.Add(customerClassificationsProfineItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("CustomerClassificationsProfinePartial", col.CustomerClassificationsProfineList);
        }


        #endregion

        #region CustomerClassificationsTurnover

        [CheckAccessAttribute]
        public ActionResult CustomerClassificationsTurnover()
        {
            var col=new CustomerClassificationsTurnoverCollection();
            return View(col.CustomerClassificationsTurnoverList);
        }

        public ActionResult CustomerClassificationsTurnoverPartial()
        {
            var col = new CustomerClassificationsTurnoverCollection();
            return PartialView("CustomerClassificationsTurnoverPartial", col.CustomerClassificationsTurnoverList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsTurnoverPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsTurnover customerClassificationsTurnoverItem)
        {
            var col = new CustomerClassificationsTurnoverCollection();
            if (ModelState.IsValid)
            {
                col.Update(customerClassificationsTurnoverItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("CustomerClassificationsTurnoverPartial", col.CustomerClassificationsTurnoverList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsTurnoverPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsTurnover customerClassificationsTurnoverItem)
        {
            var col = new CustomerClassificationsTurnoverCollection();
            if (ModelState.IsValid)
            {
                col.Delete(customerClassificationsTurnoverItem);
            }
            return PartialView("CustomerClassificationsTurnoverPartial", col.CustomerClassificationsTurnoverList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsTurnoverPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsTurnover customerClassificationsTurnoverItem)
        {
            var col = new CustomerClassificationsTurnoverCollection();
            if (ModelState.IsValid)
            {
               col.Add(customerClassificationsTurnoverItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("CustomerClassificationsTurnoverPartial", col.CustomerClassificationsTurnoverList);
        }


        #endregion

        #region CustomerClassificationsByBusiness

        [CheckAccessAttribute]
        public ActionResult CustomerClassificationsByBusiness()
        {
            var col = new CustomerClassificationsByBusinessCollection();
            return View(col.CustomerClassificationsByBusinessList);
        }

        public ActionResult CustomerClassificationsByBusinessPartial()
        {
            var col = new CustomerClassificationsByBusinessCollection();
            return PartialView("CustomerClassificationsByBusinessPartial", col.CustomerClassificationsByBusinessList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsByBusinessPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsByBusiness customerClassificationsByBusinessItem)
        {
            var col = new CustomerClassificationsByBusinessCollection();
            if (ModelState.IsValid)
            {
                col.Update(customerClassificationsByBusinessItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("CustomerClassificationsByBusinessPartial", col.CustomerClassificationsByBusinessList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsByBusinessPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsByBusiness customerClassificationsByBusinessItem)
        {
            var col = new CustomerClassificationsByBusinessCollection();
            if (ModelState.IsValid)
            {
                col.Delete(customerClassificationsByBusinessItem);
            }
            return PartialView("CustomerClassificationsByBusinessPartial", col.CustomerClassificationsByBusinessList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CustomerClassificationsByBusinessPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerClassificationsByBusiness customerClassificationsByBusinessItem)
        {
            var col = new CustomerClassificationsByBusinessCollection();
            if (ModelState.IsValid)
            {
                col.Add(customerClassificationsByBusinessItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("CustomerClassificationsByBusinessPartial", col.CustomerClassificationsByBusinessList);
        }

        #endregion

        //#region ActivitiesDirections

        //[CheckAccessAttribute]
        //public ActionResult ActivitiesDirections()
        //{
        //    return View(DB.ActivitiesDirections);
        //}

        //public ActionResult ActivitiesDirectionsPartial()
        //{
        //    return PartialView("ActivitiesDirectionsPartial", DB.ActivitiesDirections);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ActivitiesDirectionsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ActivitiesDirections activitiesDirectionItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ActivitiesDirectionsUpdate(activitiesDirectionItem);
        //    }
        //    return PartialView("ActivitiesDirectionsPartial", DB.ActivitiesDirections);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ActivitiesDirectionsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ActivitiesDirections activitiesDirectionItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ActivitiesDirectionsDelete(activitiesDirectionItem);
        //    }
        //    return PartialView("ActivitiesDirectionsPartial", DB.ActivitiesDirections);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ActivitiesDirectionsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ActivitiesDirections activitiesDirectionItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ActivitiesDirectionsInsert(activitiesDirectionItem);
        //    }
        //    return PartialView("ActivitiesDirectionsPartial", DB.ActivitiesDirections);
        //}


        //#endregion

        //#region ActivitiesCategories

        //[CheckAccessAttribute]
        //public ActionResult ActivitiesCategories()
        //{
        //    return View(DB.ActivitiesCategories);
        //}

        //public ActionResult ActivitiesCategoriesPartial()
        //{
        //    return PartialView("ActivitiesCategoriesPartial", DB.ActivitiesCategories);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ActivitiesCategoriesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ActivitiesCategories activitiesCategoryItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ActivitiesCategoriesUpdate(activitiesCategoryItem);
        //    }
        //    return PartialView("ActivitiesCategoriesPartial", DB.ActivitiesCategories);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ActivitiesCategoriesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ActivitiesCategories activitiesCategoryItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ActivitiesCategoriesDelete(activitiesCategoryItem);
        //    }
        //    return PartialView("ActivitiesCategoriesPartial", DB.ActivitiesCategories);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult ActivitiesCategoriesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ActivitiesCategories activitiesCategoryItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.ActivitiesCategoriesInsert(activitiesCategoryItem);
        //    }
        //    return PartialView("ActivitiesCategoriesPartial", DB.ActivitiesCategories);
        //}

        //#endregion
       
        //#region CustomerCategories

        //[CheckAccessAttribute]
        //public ActionResult CustomerCategories()
        //{
        //    return View(DB.CustomerCategories);
        //}

        //public ActionResult CustomerCategoriesPartial()
        //{
        //    return PartialView("CustomerCategoriesPartial", DB.CustomerCategories);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomerCategoriesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerCategories customerCategoryItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.CustomerCategoriesUpdate(customerCategoryItem);
        //    }
        //    return PartialView("CustomerCategoriesPartial", DB.CustomerCategories);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomerCategoriesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerCategories customerCategoryItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.CustomerCategoriesDelete(customerCategoryItem);
        //    }
        //    return PartialView("CustomerCategoriesPartial", DB.CustomerCategories);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomerCategoriesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CustomerCategories customerCategoryItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.CustomerCategoriesInsert(customerCategoryItem);
        //    }
        //    return PartialView("CustomerCategoriesPartial", DB.CustomerCategories);
        //}

        //#endregion

        #region VisitsTypes - moved

        [CheckAccessAttribute]
        public ActionResult VisitsTypes()
        {
            var visitsTypesCol = new CRM.Database.Model.VisitsTypesCollection();
            return View(visitsTypesCol.VisitsTypesList);
            //return View(DB.VisitsTypes);
        }

        public ActionResult VisitsTypesPartial()
        {
            var visitsTypesCol = new CRM.Database.Model.VisitsTypesCollection();
            return PartialView("VisitsTypesPartial", visitsTypesCol.VisitsTypesList);
            //return PartialView("VisitsTypesPartial", DB.VisitsTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VisitsTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.VisitsTypes visitsTypeItem)
        {
            var visitsTypesCol = new CRM.Database.Model.VisitsTypesCollection();
            if (ModelState.IsValid)
            {
                visitsTypesCol.Update(visitsTypeItem, Request.LogonUserIdentity.Name);
                //DB.VisitsTypesUpdate(visitsTypeItem);
            }
            return PartialView("VisitsTypesPartial", visitsTypesCol.VisitsTypesList);
            //return PartialView("VisitsTypesPartial", DB.VisitsTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VisitsTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.VisitsTypes visitsTypeItem)
        {
            var visitsTypesCol = new CRM.Database.Model.VisitsTypesCollection();
            if (ModelState.IsValid)
            {
                visitsTypesCol.Delete(visitsTypeItem);
                //DB.VisitsTypesDelete(visitsTypeItem);
            }
            return PartialView("VisitsTypesPartial", visitsTypesCol.VisitsTypesList);
            //return PartialView("VisitsTypesPartial", DB.VisitsTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VisitsTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.VisitsTypes visitsTypeItem)
        {
            var visitsTypesCol = new CRM.Database.Model.VisitsTypesCollection();
            if (ModelState.IsValid)
            {
                visitsTypesCol.Add(visitsTypeItem, Request.LogonUserIdentity.Name);
                //DB.VisitsTypesInsert(visitsTypeItem);
            }
            return PartialView("VisitsTypesPartial", visitsTypesCol.VisitsTypesList);
            //return PartialView("VisitsTypesPartial", DB.VisitsTypes);
        }

        #endregion

        #region Roles

        [CheckAccessAttribute]
        public ActionResult Roles()
        {
            var col = new RolesCollection();
            return View(col.RolesList);
        }

        public ActionResult RolesPartial()
        {
            var col = new RolesCollection();
            return PartialView("RolesPartial", col.RolesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Roles roleItem)
        {
            var col = new RolesCollection();
            if (ModelState.IsValid)
            {
                col.Update(roleItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("RolesPartial", col.RolesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] Roles roleItem)
        {
            var col = new RolesCollection();
            if (ModelState.IsValid)
            {
               col.Delete(roleItem);
            }
            return PartialView("RolesPartial", col.RolesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] Roles roleItem)
        {
            var col = new RolesCollection();
            if (ModelState.IsValid)
            {
           col.Add(roleItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("RolesPartial", col.RolesList);
        }

        #endregion

        #region GlassUnitMarks - moved

        [CheckAccessAttribute]
        public ActionResult GlassUnitMarks()
        {
            var glassCol = new GlassUnitMarksCollection();
            return View(glassCol.GlassUnitMarksList);
            //return View(DB.GlassUnitMarks);
        }

        public ActionResult GlassUnitMarksPartial()
        {
            var glassCol = new GlassUnitMarksCollection();
            return PartialView("GlassUnitMarksPartial", glassCol.GlassUnitMarksList);
            //return PartialView("GlassUnitMarksPartial", DB.GlassUnitMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult GlassUnitMarksPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.GlassUnitMarks glassUnitMarkItem)
        {
            var glassCol = new GlassUnitMarksCollection();
            if (ModelState.IsValid)
            {
                glassCol.Update(glassUnitMarkItem, Request.LogonUserIdentity.Name);
                //DB.GlassUnitMarksUpdate(glassUnitMarkItem);
            }
            return PartialView("GlassUnitMarksPartial", glassCol.GlassUnitMarksList);
            //return PartialView("GlassUnitMarksPartial", DB.GlassUnitMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult GlassUnitMarksPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.GlassUnitMarks glassUnitMarkItem)
        {
            var glassCol = new GlassUnitMarksCollection();
            if (ModelState.IsValid)
            {
                glassCol.Delete(glassUnitMarkItem);
                //DB.GlassUnitMarksDelete(glassUnitMarkItem);
            }
            return PartialView("GlassUnitMarksPartial", glassCol.GlassUnitMarksList);
            //return PartialView("GlassUnitMarksPartial", DB.GlassUnitMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult GlassUnitMarksPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.GlassUnitMarks glassUnitMarkItem)
        {
            var glassCol = new GlassUnitMarksCollection();
            if (ModelState.IsValid)
            {
                glassCol.Add(glassUnitMarkItem, Request.LogonUserIdentity.Name);
                //DB.GlassUnitMarksInsert(glassUnitMarkItem);
            }
            return PartialView("GlassUnitMarksPartial", glassCol.GlassUnitMarksList);
            //return PartialView("GlassUnitMarksPartial", DB.GlassUnitMarks);
        }
        
        #endregion
        
        #region FurnitureMarks - moved

        [CheckAccessAttribute]
        public ActionResult FurnitureMarks()
        {
            var furnitureCol = new FurnitureMarksCollection();
            return View(furnitureCol.FurnitureMarksList);
            //return View(DB.FurnitureMarks);
        }

        public ActionResult FurnitureMarksPartial()
        {
            var furnitureCol = new FurnitureMarksCollection();
            return PartialView("FurnitureMarksPartial", furnitureCol.FurnitureMarksList);
            //return PartialView("FurnitureMarksPartial", DB.FurnitureMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult FurnitureMarksPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.FurnitureMarks furnitureMarkItem)
        {
            var furnitureCol = new FurnitureMarksCollection();
            if (ModelState.IsValid)
            {
                furnitureCol.Update(furnitureMarkItem, Request.LogonUserIdentity.Name);
                //DB.FurnitureMarksUpdate(furnitureMarkItem);
            }
            return PartialView("FurnitureMarksPartial", furnitureCol.FurnitureMarksList);
            //return PartialView("FurnitureMarksPartial", DB.FurnitureMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult FurnitureMarksPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.FurnitureMarks furnitureMarkItem)
        {
            var furnitureCol = new FurnitureMarksCollection();
            if (ModelState.IsValid)
            {
                furnitureCol.Delete(furnitureMarkItem);
                //DB.FurnitureMarksDelete(furnitureMarkItem);
            }
            return PartialView("FurnitureMarksPartial", furnitureCol.FurnitureMarksList);
            //return PartialView("FurnitureMarksPartial", DB.FurnitureMarks);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult FurnitureMarksPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.FurnitureMarks furnitureMarkItem)
        {
            var furnitureCol = new FurnitureMarksCollection();
            if (ModelState.IsValid)
            {
                furnitureCol.Add(furnitureMarkItem, Request.LogonUserIdentity.Name);
                //DB.FurnitureMarksInsert(furnitureMarkItem);
            }
            return PartialView("FurnitureMarksPartial", furnitureCol.FurnitureMarksList);
            //return PartialView("FurnitureMarksPartial", DB.FurnitureMarks);
        }
        
        #endregion

        #region Vendors - moved

        [CheckAccessAttribute]
        public ActionResult Vendors()
        {
            var vendorsCol = new CRM.Database.Model.VendorsCollection();
            return View(vendorsCol.VendorsList);
            //return View(DB.Vendors);
        }

        public ActionResult VendorsPartial()
        {
            var vendorsCol = new CRM.Database.Model.VendorsCollection();
            return PartialView("VendorsPartial", vendorsCol.VendorsList);
            //return PartialView("VendorsPartial", DB.Vendors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VendorsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Vendors vendorItem)
        {
            var vendorsCol = new CRM.Database.Model.VendorsCollection();
            if (ModelState.IsValid)
            {
                vendorsCol.Update(vendorItem, Request.LogonUserIdentity.Name);
                //DB.VendorsUpdate(vendorItem);
            }
            return PartialView("VendorsPartial", vendorsCol.VendorsList);
            //return PartialView("VendorsPartial", DB.Vendors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VendorsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Vendors vendorItem)
        {
            var vendorsCol = new CRM.Database.Model.VendorsCollection();
            if (ModelState.IsValid)
            {
                vendorsCol.Delete(vendorItem);
                //DB.VendorsDelete(vendorItem);
            }
            return PartialView("VendorsPartial", vendorsCol.VendorsList);
            //return PartialView("VendorsPartial", DB.Vendors);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VendorsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Vendors vendorItem)
        {
            var vendorsCol = new CRM.Database.Model.VendorsCollection();
            if (ModelState.IsValid)
            {
                vendorsCol.Add(vendorItem, Request.LogonUserIdentity.Name);
                //DB.VendorsInsert(vendorItem);
            }
            return PartialView("VendorsPartial", vendorsCol.VendorsList);
            //return PartialView("VendorsPartial", DB.Vendors);
        }


        #endregion

        #region VendorsTypes - moved

        [CheckAccessAttribute]
        public ActionResult VendorsTypes()
        {
            var vendorsTypesCol = new CRM.Database.Model.VendorsTypesCollection();
            return View(vendorsTypesCol.VendorsTypesList);
            //return View(DB.VendorsTypes);
        }

        public ActionResult VendorsTypesPartial()
        {
            var vendorsTypesCol = new CRM.Database.Model.VendorsTypesCollection();
            return PartialView("VendorsTypesPartial", vendorsTypesCol.VendorsTypesList);
            //return PartialView("VendorsTypesPartial", DB.VendorsTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VendorsTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.VendorsTypes vendorsTypeItem)
        {
            var vendorsTypesCol = new CRM.Database.Model.VendorsTypesCollection();
            if (ModelState.IsValid)
            {
                vendorsTypesCol.Update(vendorsTypeItem, Request.LogonUserIdentity.Name);
                //DB.VendorsTypesUpdate(vendorsTypeItem);
            }
            return PartialView("VendorsTypesPartial", vendorsTypesCol.VendorsTypesList);
            //return PartialView("VendorsTypesPartial", DB.VendorsTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VendorsTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.VendorsTypes vendorsTypeItem)
        {
            var vendorsTypesCol = new CRM.Database.Model.VendorsTypesCollection();
            if (ModelState.IsValid)
            {
                vendorsTypesCol.Delete(vendorsTypeItem);
                //DB.VendorsTypesDelete(vendorsTypeItem);
            }
            return PartialView("VendorsTypesPartial", vendorsTypesCol.VendorsTypesList);
            //return PartialView("VendorsTypesPartial", DB.VendorsTypes);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult VendorsTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.VendorsTypes vendorsTypeItem)
        {
            var vendorsTypesCol = new CRM.Database.Model.VendorsTypesCollection();
            if (ModelState.IsValid)
            {
                vendorsTypesCol.Add(vendorsTypeItem, Request.LogonUserIdentity.Name);
                //DB.VendorsTypesInsert(vendorsTypeItem);
            }
            return PartialView("VendorsTypesPartial", vendorsTypesCol.VendorsTypesList);
            //return PartialView("VendorsTypesPartial", DB.VendorsTypes);
        }


        #endregion

        //#region Turnovers

        ////[CheckAccessAttribute]
        ////public ActionResult Turnovers()
        ////{
        ////    return View(DB.Turnovers);
        ////}

        ////public ActionResult TurnoversPartial()
        ////{
        ////    return PartialView("TurnoversPartial", DB.Turnovers);
        ////}

        ////[HttpPost, ValidateInput(false)]
        ////public ActionResult TurnoversPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Turnovers turnoverItem)
        ////{
        ////    if (ModelState.IsValid)
        ////    {
        ////       // DB.TurnoversUpdate(turnoverItem);
        ////    }
        ////    return PartialView("TurnoversPartial", DB.Turnovers);
        ////}

        ////[HttpPost, ValidateInput(false)]
        ////public ActionResult TurnoversPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] Turnovers turnoverItem)
        ////{
        ////    if (ModelState.IsValid)
        ////    {
        ////      //  DB.TurnoversDelete(turnoverItem);
        ////    }
        ////    return PartialView("TurnoversPartial", DB.Turnovers);
        ////}

        ////[HttpPost, ValidateInput(false)]
        ////public ActionResult TurnoversPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] Turnovers turnoverItem)
        ////{
        ////    if (ModelState.IsValid)
        ////    {
        ////       // DB.TurnoversInsert(turnoverItem, Request.LogonUserIdentity.Name);
        ////    }
        ////    return PartialView("TurnoversPartial", DB.Turnovers);
        ////}
        
        //#endregion

        //#region TurnoverClassifications

        //[CheckAccessAttribute]
        //public ActionResult TurnoverClassifications()
        //{
        //    return View(DB.TurnoverClassifications);
        //}

        //public ActionResult TurnoverClassificationsPartial()
        //{
        //    return PartialView("TurnoverClassificationsPartial", DB.TurnoverClassifications);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TurnoverClassificationsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TurnoverClassifications turnoverClassificationItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TurnoverClassificationsUpdate(turnoverClassificationItem);
        //    }
        //    return PartialView("TurnoverClassificationsPartial", DB.TurnoverClassifications);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TurnoverClassificationsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TurnoverClassifications turnoverClassificationItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TurnoverClassificationsDelete(turnoverClassificationItem);
        //    }
        //    return PartialView("TurnoverClassificationsPartial", DB.TurnoverClassifications);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TurnoverClassificationsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TurnoverClassifications turnoverClassificationItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TurnoverClassificationsInsert(turnoverClassificationItem);
        //    }
        //    return PartialView("TurnoverClassificationsPartial", DB.TurnoverClassifications);
        //}
        
        //#endregion

        //#region DistributionChannelTypes

        //[CheckAccessAttribute]
        //public ActionResult DistributionChannelTypes()
        //{
        //    return View(DB.DistributionChannelTypes);
        //}

        //public ActionResult DistributionChannelTypesPartial()
        //{
        //    return PartialView("DistributionChannelTypesPartial", DB.DistributionChannelTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult DistributionChannelTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] DistributionChannelTypes distributionChannelTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.DistributionChannelTypesUpdate(distributionChannelTypeItem);
        //    }
        //    return PartialView("DistributionChannelTypesPartial", DB.DistributionChannelTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult DistributionChannelTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] DistributionChannelTypes distributionChannelTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.DistributionChannelTypesDelete(distributionChannelTypeItem);
        //    }
        //    return PartialView("DistributionChannelTypesPartial", DB.DistributionChannelTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult DistributionChannelTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] DistributionChannelTypes distributionChannelTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.DistributionChannelTypesInsert(distributionChannelTypeItem);
        //    }
        //    return PartialView("DistributionChannelTypesPartial", DB.DistributionChannelTypes);
        //}


        //#endregion

        //#region DistributionChannels

        //[CheckAccessAttribute]
        //public ActionResult DistributionChannels()
        //{
        //    return View(DB.DistributionChannels);
        //}

        //public ActionResult DistributionChannelsPartial()
        //{
        //    return PartialView("DistributionChannelsPartial", DB.DistributionChannels);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult DistributionChannelsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] DistributionChannels distributionChannelItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.DistributionChannelsUpdate(distributionChannelItem);
        //    }
        //    return PartialView("DistributionChannelsPartial", DB.DistributionChannels);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult DistributionChannelsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] DistributionChannels distributionChannelItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.DistributionChannelsDelete(distributionChannelItem);
        //    }
        //    return PartialView("DistributionChannelsPartial", DB.DistributionChannels);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult DistributionChannelsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] DistributionChannels distributionChannelItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.DistributionChannelsInsert(distributionChannelItem);
        //    }
        //    return PartialView("DistributionChannelsPartial", DB.DistributionChannels);
        //}

        //#endregion

        //#region CustomersProductsSystems

        //[CheckAccessAttribute]
        //public ActionResult CustomersProductsSystems()
        //{
        //    return View(DB.CustomersProductsSystems);
        //}

        //public ActionResult CustomersProductsSystemsPartial()
        //{
        //    return PartialView("CustomersProductsSystemsPartial", DB.CustomersProductsSystems);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomersProductsSystemsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CustomersProductsSystems customersProductsSystemItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.CustomersProductsSystemsUpdate(customersProductsSystemItem);
        //    }
        //    return PartialView("CustomersProductsSystemsPartial", DB.CustomersProductsSystems);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomersProductsSystemsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CustomersProductsSystems customersProductsSystemItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.CustomersProductsSystemsDelete(customersProductsSystemItem);
        //    }
        //    return PartialView("CustomersProductsSystemsPartial", DB.CustomersProductsSystems);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult CustomersProductsSystemsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CustomersProductsSystems customersProductsSystemItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.CustomersProductsSystemsInsert(customersProductsSystemItem);
        //    }
        //    return PartialView("CustomersProductsSystemsPartial", DB.CustomersProductsSystems);
        //}

        //#endregion

        //#region EquipmentTypesVendorTypes

        //[CheckAccessAttribute]
        //public ActionResult EquipmentTypesVendorTypes()
        //{
        //    return View(DB.EquipmentTypesVendorTypes);
        //}

        //public ActionResult EquipmentTypesVendorTypesPartial()
        //{
        //    return PartialView("EquipmentTypesVendorTypesPartial", DB.EquipmentTypesVendorTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult EquipmentTypesVendorTypesUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] EquipmentTypesVendorTypes equipmentTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.EquipmentTypesVendorTypesUpdate(equipmentTypeItem);
        //    }
        //    return PartialView("EquipmentTypesVendorTypesPartial", DB.EquipmentTypesVendorTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult EquipmentTypesVendorTypesDelete([ModelBinder(typeof(DevExpressEditorsBinder))] EquipmentTypesVendorTypes equipmentTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.EquipmentTypesVendorTypesDelete(equipmentTypeItem);
        //    }
        //    return PartialView("EquipmentTypesVendorTypesPartial", DB.EquipmentTypesVendorTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult EquipmentTypesVendorTypesAdd([ModelBinder(typeof(DevExpressEditorsBinder))] EquipmentTypesVendorTypes equipmentTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.EquipmentTypesVendorTypesInsert(equipmentTypeItem);
        //    }
        //    return PartialView("EquipmentTypesVendorTypesPartial", DB.EquipmentTypesVendorTypes);
        //}

        //#endregion

        #region UsersInRoles

        [CheckAccessAttribute]
        public ActionResult UsersInRoles()
        {
            var col = new UsersInRolesCollection();
            return View(col.UserInRolesList);
        }

        public ActionResult UsersInRolesPartial()
        {
            var col = new UsersInRolesCollection();
            return PartialView("UsersInRolesPartial",col.UserInRolesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UsersInRolesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] UsersInRoles usersInRoleItem)
        {
            var col = new UsersInRolesCollection();
            if (ModelState.IsValid)
            {
                col.Update(usersInRoleItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("UsersInRolesPartial", col.UserInRolesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UsersInRolesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] UsersInRoles usersInRoleItem)
        {
            var col = new UsersInRolesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(usersInRoleItem);
            }
            return PartialView("UsersInRolesPartial", col.UserInRolesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UsersInRolesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] UsersInRoles usersInRoleItem)
        {
            var col = new UsersInRolesCollection();
            if (ModelState.IsValid)
            {
                col.Add(usersInRoleItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("UsersInRolesPartial", col.UserInRolesList);
        }


        #endregion

        #region RolesAccesses

        [CheckAccessAttribute]
        public ActionResult RolesAccesses()
        {
            var col = new RolesAccessesCollection();
            return View(col.RolesAccessesList);
        }

        public ActionResult RolesAccessesPartial()
        {
            var col = new RolesAccessesCollection();
            return PartialView("RolesAccessesPartial", col.RolesAccessesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesAccessesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] RolesAccesses rolesAccessItem)
        {
            var col = new RolesAccessesCollection();
            if (ModelState.IsValid)
            {
                col.Update(rolesAccessItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("RolesAccessesPartial", col.RolesAccessesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesAccessesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] RolesAccesses rolesAccessItem)
        {
            var col = new RolesAccessesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(rolesAccessItem);
            }
            return PartialView("RolesAccessesPartial", col.RolesAccessesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesAccessesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] RolesAccesses rolesAccessItem)
        {
            var col = new RolesAccessesCollection();
            if (ModelState.IsValid)
            {
                col.Add(rolesAccessItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("RolesAccessesPartial", col.RolesAccessesList);
        }

        #endregion

        #region ControllersAndActions

        [CheckAccessAttribute]
        public ActionResult ControllersAndActions()
        {
            var col = new ControllersAndActionsCollection();
            return View(col.ControllersAndActionsList);
        }

        public ActionResult ControllersAndActionsPartial()
        {
            var col = new ControllersAndActionsCollection();
            return PartialView("ControllersAndActionsPartial", col.ControllersAndActionsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ControllersAndActionsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ControllersAndActions controllersAndActionItem)
        {
            var col = new ControllersAndActionsCollection();
            if (ModelState.IsValid)
            {

                col.Update(controllersAndActionItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("ControllersAndActionsPartial", col.ControllersAndActionsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ControllersAndActionsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ControllersAndActions controllersAndActionItem)
        {
            var col = new ControllersAndActionsCollection();
            if (ModelState.IsValid)
            {
                col.Delete(controllersAndActionItem);
            }
            return PartialView("ControllersAndActionsPartial", col.ControllersAndActionsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ControllersAndActionsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ControllersAndActions controllersAndActionItem)
        {
            var col = new ControllersAndActionsCollection();
            if (ModelState.IsValid)
            {
                col.Add(controllersAndActionItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("ControllersAndActionsPartial", col.ControllersAndActionsList);
        }


        #endregion

        #region AddressesTypes

        [CheckAccessAttribute]
        public ActionResult AddressesTypes()
        {
            var col = new AddressesTypesCollection();
            return View(col.AddressesTypesList);
        }

        public ActionResult AddressesTypesPartial()
        {
            var col = new AddressesTypesCollection();
            return PartialView("AddressesTypesPartial",col.AddressesTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult AddressesTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] AddressesTypes addressesTypeItem)
        {
            var col = new AddressesTypesCollection();
            if (ModelState.IsValid)
            {

                if (!col.Update(addressesTypeItem, Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
            }
            return PartialView("AddressesTypesPartial", col.AddressesTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult AddressesTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] AddressesTypes addressesTypeItem)
        {
            var col = new AddressesTypesCollection();
            if (ModelState.IsValid)
            {
                if (!col.Delete(addressesTypeItem))
                {
                  //  throw new HttpException();
                    //   return PartialView("Error500");
                }
            }
            return PartialView("AddressesTypesPartial", col.AddressesTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult AddressesTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] AddressesTypes addressesTypeItem)
        {
            var col = new AddressesTypesCollection();
            if (ModelState.IsValid)
            {
                if (!col.Add(addressesTypeItem,Request.LogonUserIdentity.Name))
                    return RedirectToAction("Error", "Home");
            }
            return PartialView("AddressesTypesPartial", col.AddressesTypesList);
        }


        #endregion

        #region RolesTypes

        [CheckAccessAttribute]
        public ActionResult RolesTypes()
        {
            var col = new RolesTypesCollection();
            return View(col.RolesTypesList);
        }

        public ActionResult RolesTypesPartial()
        {
            var col = new RolesTypesCollection();
            return PartialView("RolesTypesPartial", col.RolesTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] RolesTypes rolesTypeItem)
        {
            var col = new RolesTypesCollection();
            if (ModelState.IsValid)
            {
                col.Update(rolesTypeItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("RolesTypesPartial", col.RolesTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] RolesTypes rolesTypeItem)
        {
            var col = new RolesTypesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(rolesTypeItem);
            }
            return PartialView("RolesTypesPartial", col.RolesTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult RolesTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] RolesTypes rolesTypeItem)
        {
            var col = new RolesTypesCollection();
            if (ModelState.IsValid)
            {
                col.Add(rolesTypeItem,Request.LogonUserIdentity.Name);
            }
            return PartialView("RolesTypesPartial", col.RolesTypesList);
        }

        #endregion

        #region Users

        [CheckAccessAttribute]
        public ActionResult Users()
        {
            var col = new UsersCollection();
            return View(col.UsersList);
        }

        public ActionResult UsersPartial()
        {
            var col = new UsersCollection();
            return PartialView("UsersPartial", col.UsersList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UsersPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Users userItem)
        {

            var col = new UsersCollection();
            if (ModelState.IsValid)
            {

                col.Update(userItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("UsersPartial", col.UsersList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UsersPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] Users userItem)
        {
            var col = new UsersCollection();
            if (ModelState.IsValid)
            {
                col.Delete(userItem);
            }
            return PartialView("UsersPartial", col.UsersList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UsersPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] Users userItem)
        {
            var col = new UsersCollection();
            if (ModelState.IsValid)
            {
                col.Add(userItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("UsersPartial", col.UsersList);
        }

        #endregion

        #region ContractsTypes

        [CheckAccessAttribute]
        public ActionResult ContractsTypes()
        {
            var col = new ContractsTypesCollection();
            return View(col.ContractsTypesList);
        }

        public ActionResult ContractsTypesPartial()
        {
            var col = new ContractsTypesCollection();
            return PartialView("ContractsTypesPartial", col.ContractsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ContractsTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ContractsTypes contractsTypeItem)
        {
            var col = new ContractsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Update(contractsTypeItem,CurrentUser);
            }
            return PartialView("ContractsTypesPartial", col.ContractsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ContractsTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ContractsTypes contractsTypeItem)
        {
            var col = new ContractsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(contractsTypeItem);
            }
            return PartialView("ContractsTypesPartial", col.ContractsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ContractsTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ContractsTypes contractsTypeItem)
        {
            var col = new ContractsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Add(contractsTypeItem,CurrentUser);
            }
            return PartialView("ContractsTypesPartial", col.ContractsTypesList);
        }

        #endregion

        #region ConditionsTypes

        [CheckAccessAttribute]
        public ActionResult ConditionsTypes()
        {
            var col = new ConditionsTypesCollection();
            return View(col.ConditionsTypesList);
        }

        public ActionResult ConditionsTypesPartial()
        {
            var col = new ConditionsTypesCollection();
            return PartialView("ConditionsTypesPartial", col.ConditionsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ConditionsTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ConditionsTypes conditionsTypeItem)
        {
            var col = new ConditionsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Update(conditionsTypeItem,CurrentUser);
            }
            return PartialView("ConditionsTypesPartial", col.ConditionsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ConditionsTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ConditionsTypes conditionsTypeItem)
        {
            var col = new ConditionsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(conditionsTypeItem);
            }
            return PartialView("ConditionsTypesPartial", col.ConditionsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ConditionsTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ConditionsTypes conditionsTypeItem)
        {
            var col = new ConditionsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Add(conditionsTypeItem,CurrentUser);
            }
            return PartialView("ConditionsTypesPartial", col.ConditionsTypesList);
        }

        #endregion

        #region BonusTypes

        [CheckAccessAttribute]
        public ActionResult BonusTypes()
        {
            var col = new BonusTypesCollection();
            return View(col.BonusTypesList);
        }

        public ActionResult BonusTypesPartial()
        {
            var col = new BonusTypesCollection();
            return PartialView("BonusTypesPartial", col.BonusTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult BonusTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] BonusTypes bonusTypeItem)
        {
            var col = new BonusTypesCollection();
            if (ModelState.IsValid)
            {
                col.Update(bonusTypeItem,CurrentUser);
            }
            return PartialView("BonusTypesPartial", col.BonusTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult BonusTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] BonusTypes bonusTypeItem)
        {
            var col = new BonusTypesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(bonusTypeItem);
            }
            return PartialView("BonusTypesPartial", col.BonusTypesList);
        }


        [HttpPost, ValidateInput(false)]
        public ActionResult BonusTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] BonusTypes bonusTypeItem)
        {
            var col = new BonusTypesCollection();
            if (ModelState.IsValid)
            {
                col.Add(bonusTypeItem,CurrentUser);
            }
            return PartialView("BonusTypesPartial", col.BonusTypesList);
        }

        #endregion

        #region CompensationsTypes

        [CheckAccessAttribute]
        public ActionResult CompensationsTypes()
        {
            var col = new CompensationsTypesCollection();
            return View(col.CompensationsTypesList);
        }

        public ActionResult CompensationsTypesPartial()
        {
            var col = new CompensationsTypesCollection();
            return PartialView("CompensationsTypesPartial", col.CompensationsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CompensationsTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CompensationsTypes compensationsTypeItem)
        {
            var col = new CompensationsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Update(compensationsTypeItem,CurrentUser);
            }
            return PartialView("CompensationsTypesPartial", col.CompensationsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CompensationsTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CompensationsTypes compensationsTypeItem)
        {
            var col = new CompensationsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(compensationsTypeItem);
            }
            return PartialView("CompensationsTypesPartial", col.CompensationsTypesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult CompensationsTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CompensationsTypes compensationsTypeItem)
        {
            var col = new CompensationsTypesCollection();
            if (ModelState.IsValid)
            {
                col.Add(compensationsTypeItem,CurrentUser);
            }
            return PartialView("CompensationsTypesPartial", col.CompensationsTypesList);
        }

        #endregion

        #region Units

        [CheckAccessAttribute]
        public ActionResult Units()
        {
            var col = new UnitsCollection();
            return View(col.UnitsList);
        }

        public ActionResult UnitsPartial()
        {
            var col = new UnitsCollection();
            return PartialView("UnitsPartial", col.UnitsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UnitsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Units unitItem)
        {
            var col = new UnitsCollection();
            if (ModelState.IsValid)
            {
                col.Update(unitItem,CurrentUser);
            }
            return PartialView("UnitsPartial", col.UnitsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UnitsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] Units unitItem)
        {
            var col = new UnitsCollection();
            if (ModelState.IsValid)
            {
                col.Delete(unitItem);
            }
            return PartialView("UnitsPartial", col.UnitsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult UnitsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] Units unitItem)
        {
            var col = new UnitsCollection();
            if (ModelState.IsValid)
            {
                col.Add(unitItem,CurrentUser);
            }
            return PartialView("UnitsPartial", col.UnitsList);
        }

        #endregion

        #region ContractsStatuses

        [CheckAccessAttribute]
        public ActionResult ContractsStatuses()
        {

            var col = new ContractsStatusesCollection();
            return View(col.ContractsStatusesList);
        }

        public ActionResult ContractsStatusesPartial()
        {
            var col = new ContractsStatusesCollection();
            return PartialView("ContractsStatusesPartial", col.ContractsStatusesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ContractsStatusesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ContractsStatuses contractsStatusItem)
        {
            var col = new ContractsStatusesCollection();
            if (ModelState.IsValid)
            {
                col.Update(contractsStatusItem,CurrentUser);
            }
            return PartialView("ContractsStatusesPartial", col.ContractsStatusesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ContractsStatusesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ContractsStatuses contractsStatusItem)
        {
            var col = new ContractsStatusesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(contractsStatusItem);
            }
            return PartialView("ContractsStatusesPartial", col.ContractsStatusesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ContractsStatusesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] ContractsStatuses contractsStatusItem)
        {
            var col = new ContractsStatusesCollection();
            if (ModelState.IsValid)
            {
                col.Add(contractsStatusItem,CurrentUser);
            }
            return PartialView("ContractsStatusesPartial", col.ContractsStatusesList);
        }

        #endregion

        #region InternalCourses

        [CheckAccessAttribute]
        public ActionResult InternalCourses()
        {
            var col = new InternalCoursesCollection();
            return View(col.InternalCoursesList);
        }

        public ActionResult InternalCoursesPartial()
        {
            var col = new InternalCoursesCollection();
            return PartialView("InternalCoursesPartial", col.InternalCoursesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult InternalCoursesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] InternalCourses internalCourseItem)
        {
            var col = new InternalCoursesCollection();
            if (ModelState.IsValid)
            {
                col.Update(internalCourseItem,CurrentUser);
            }
            return PartialView("InternalCoursesPartial", col.InternalCoursesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult InternalCoursesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] InternalCourses internalCourseItem)
        {
            var col = new InternalCoursesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(internalCourseItem);
            }
            return PartialView("InternalCoursesPartial", col.InternalCoursesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult InternalCoursesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] InternalCourses internalCourseItem)
        {
            var col = new InternalCoursesCollection();
            if (ModelState.IsValid)
            {
                col.Add(internalCourseItem,CurrentUser);
            }
            return PartialView("InternalCoursesPartial", col.InternalCoursesList);
        }

        #endregion

        #region TrucksCapacities

        [CheckAccessAttribute]
        public ActionResult TrucksCapacities()
        {
            var col = new TrucksCapacitiesCollection();
            return View(col.TrucksCapacitiesList);
        }

        public ActionResult TrucksCapacitiesPartial()
        {
            var col = new TrucksCapacitiesCollection();
            return PartialView("TrucksCapacitiesPartial", col.TrucksCapacitiesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult TrucksCapacitiesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrucksCapacities trucksCapacityItem)
        {
            var col = new TrucksCapacitiesCollection();
            if (ModelState.IsValid)
            {
                col.Update(trucksCapacityItem,CurrentUser);
            }
            return PartialView("TrucksCapacitiesPartial", col.TrucksCapacitiesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult TrucksCapacitiesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrucksCapacities trucksCapacityItem)
        {
            var col = new TrucksCapacitiesCollection();
            if (ModelState.IsValid)
            {
                col.Delete(trucksCapacityItem);
            }
            return PartialView("TrucksCapacitiesPartial", col.TrucksCapacitiesList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult TrucksCapacitiesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrucksCapacities trucksCapacityItem)
        {
            var col = new TrucksCapacitiesCollection();
            if (ModelState.IsValid)
            {
                col.Add(trucksCapacityItem,CurrentUser);
            }
            return PartialView("TrucksCapacitiesPartial", col.TrucksCapacitiesList);
        }

        #endregion

        //01.11.2012
        //#region TrainigAuditoriums

        //[CheckAccessAttribute]
        //public ActionResult TrainigAuditoriums()
        //{
        //    return View(DB.TrainigAuditoriums);
        //}

        //public ActionResult TrainigAuditoriumsPartial()
        //{
        //    return PartialView("TrainigAuditoriumsPartial", DB.TrainigAuditoriums);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainigAuditoriumsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainigAuditoriums trainigAuditoriumItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainigAuditoriumsUpdate(trainigAuditoriumItem);
        //    }
        //    return PartialView("TrainigAuditoriumsPartial", DB.TrainigAuditoriums);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainigAuditoriumsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainigAuditoriums trainigAuditoriumItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainigAuditoriumsDelete(trainigAuditoriumItem);
        //    }
        //    return PartialView("TrainigAuditoriumsPartial", DB.TrainigAuditoriums);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainigAuditoriumsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainigAuditoriums trainigAuditoriumItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainigAuditoriumsInsert(trainigAuditoriumItem);
        //    }
        //    return PartialView("TrainigAuditoriumsPartial", DB.TrainigAuditoriums);
        //}

        //#endregion

        //01.11.2012
        //#region TrainingRequestsStatuses

        //[CheckAccessAttribute]
        //public ActionResult TrainingRequestsStatuses()
        //{
        //    return View(DB.TrainingRequestsStatuses);
        //}

        //public ActionResult TrainingRequestsStatusesPartial()
        //{
        //    return PartialView("TrainingRequestsStatusesPartial", DB.TrainingRequestsStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingRequestsStatusesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingRequestsStatuses trainingRequestsStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingRequestsStatusesUpdate(trainingRequestsStatusItem);
        //    }
        //    return PartialView("TrainingRequestsStatusesPartial", DB.TrainingRequestsStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingRequestsStatusesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingRequestsStatuses trainingRequestsStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingRequestsStatusesDelete(trainingRequestsStatusItem);
        //    }
        //    return PartialView("TrainingRequestsStatusesPartial", DB.TrainingRequestsStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingRequestsStatusesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingRequestsStatuses trainingRequestsStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingRequestsStatusesInsert(trainingRequestsStatusItem);
        //    }
        //    return PartialView("TrainingRequestsStatusesPartial", DB.TrainingRequestsStatuses);
        //}

        //#endregion

        //#region TrainingParticipantsStatuses

        //[CheckAccessAttribute]
        //public ActionResult TrainingParticipantsStatuses()
        //{
        //    return View(DB.TrainingParticipantsStatuses);
        //}

        //public ActionResult TrainingParticipantsStatusesPartial()
        //{
        //    return PartialView("TrainingParticipantsStatusesPartial", DB.TrainingParticipantsStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingParticipantsStatusesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingParticipantsStatuses trainingParticipantsStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingParticipantsStatusesUpdate(trainingParticipantsStatusItem);
        //    }
        //    return PartialView("TrainingParticipantsStatusesPartial", DB.TrainingParticipantsStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingParticipantsStatusesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingParticipantsStatuses trainingParticipantsStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingParticipantsStatusesDelete(trainingParticipantsStatusItem);
        //    }
        //    return PartialView("TrainingParticipantsStatusesPartial", DB.TrainingParticipantsStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingParticipantsStatusesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingParticipantsStatuses trainingParticipantsStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingParticipantsStatusesInsert(trainingParticipantsStatusItem);
        //    }
        //    return PartialView("TrainingParticipantsStatusesPartial", DB.TrainingParticipantsStatuses);
        //}

        //#endregion

        //#region TrainingCoursesStatuses

        //[CheckAccessAttribute]
        //public ActionResult TrainingCoursesStatuses()
        //{
        //    return View(DB.TrainingCoursesStatuses);
        //}

        //public ActionResult TrainingCoursesStatusesPartial()
        //{
        //    return PartialView("TrainingCoursesStatusesPartial", DB.TrainingCoursesStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingCoursesStatusesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingCoursesStatuses trainingCoursesStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingCoursesStatusesUpdate(trainingCoursesStatusItem);
        //    }
        //    return PartialView("TrainingCoursesStatusesPartial", DB.TrainingCoursesStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingCoursesStatusesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingCoursesStatuses trainingCoursesStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingCoursesStatusesDelete(trainingCoursesStatusItem);
        //    }
        //    return PartialView("TrainingCoursesStatusesPartial", DB.TrainingCoursesStatuses);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingCoursesStatusesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingCoursesStatuses trainingCoursesStatusItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingCoursesStatusesInsert(trainingCoursesStatusItem);
        //    }
        //    return PartialView("TrainingCoursesStatusesPartial", DB.TrainingCoursesStatuses);
        //}

        //#endregion

        //#region TrainingCoursesTypes

        //[CheckAccessAttribute]
        //public ActionResult TrainingCoursesTypes()
        //{
        //    return View(DB.TrainingCoursesTypes);
        //}

        //public ActionResult TrainingCoursesTypesPartial()
        //{
        //    return PartialView("TrainingCoursesTypesPartial", DB.TrainingCoursesTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingCoursesTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingCoursesTypes trainingCoursesTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingCoursesTypesUpdate(trainingCoursesTypeItem);
        //    }
        //    return PartialView("TrainingCoursesTypesPartial", DB.TrainingCoursesTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingCoursesTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingCoursesTypes trainingCoursesTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingCoursesTypesDelete(trainingCoursesTypeItem);
        //    }
        //    return PartialView("TrainingCoursesTypesPartial", DB.TrainingCoursesTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingCoursesTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingCoursesTypes trainingCoursesTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingCoursesTypesInsert(trainingCoursesTypeItem);
        //    }
        //    return PartialView("TrainingCoursesTypesPartial", DB.TrainingCoursesTypes);
        //}

        //#endregion

        //#region Rubrics

        //[CheckAccessAttribute]
        //public ActionResult Rubrics()
        //{
        //    return View(DB.Rubrics);
        //}

        //public ActionResult RubricsPartial()
        //{
        //    return PartialView("RubricsPartial", DB.Rubrics);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult RubricsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Rubrics rubricsItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.RubricsUpdate(rubricsItem);
        //    }
        //    return PartialView("RubricsPartial", DB.Rubrics);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult RubricsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] Rubrics rubricsItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.RubricsDelete(rubricsItem);
        //    }
        //    return PartialView("RubricsPartial", DB.Rubrics);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult RubricsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] Rubrics rubricsItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.RubricsInsert(rubricsItem);
        //    }
        //    return PartialView("RubricsPartial", DB.Rubrics);
        //}

        //#endregion
        //01.11.2012
        //#region TrainingsCenters

        //[CheckAccessAttribute]
        //public ActionResult TrainingsCenters()
        //{
        //    return View(DB.TrainingsCenters);
        //}

        //public ActionResult TrainingsCentersPartial()
        //{
        //    return PartialView("TrainingsCentersPartial", DB.TrainingsCenters);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsCentersPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsCenters trainingsCenterItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsCentersUpdate(trainingsCenterItem);
        //    }
        //    return PartialView("TrainingsCentersPartial", DB.TrainingsCenters);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsCentersPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsCenters trainingsCenterItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsCentersDelete(trainingsCenterItem);
        //    }
        //    return PartialView("TrainingsCentersPartial", DB.TrainingsCenters);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsCentersPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsCenters trainingsCenterItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsCentersInsert(trainingsCenterItem);
        //    }
        //    return PartialView("TrainingsCentersPartial", DB.TrainingsCenters);
        //}

        //#endregion

        //#region TrainingsPlaces

        //[CheckAccessAttribute]
        //public ActionResult TrainingsPlaces()
        //{
        //    return View(DB.TrainingsPlaces);
        //}

        //public ActionResult TrainingsPlacesPartial()
        //{
        //    return PartialView("TrainingsPlacesPartial", DB.TrainingsPlaces);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsPlacesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsPlaces trainingsPlaceItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsPlacesUpdate(trainingsPlaceItem);
        //    }
        //    return PartialView("TrainingsPlacesPartial", DB.TrainingsPlaces);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsPlacesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsPlaces trainingsPlaceItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsPlacesDelete(trainingsPlaceItem);
        //    }
        //    return PartialView("TrainingsPlacesPartial", DB.TrainingsPlaces);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsPlacesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsPlaces trainingsPlaceItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsPlacesInsert(trainingsPlaceItem);
        //    }
        //    return PartialView("TrainingsPlacesPartial", DB.TrainingsPlaces);
        //}

        //#endregion
        //01.11.2012
        //#region TrainingsCentersTypes

        //[CheckAccessAttribute]
        //public ActionResult TrainingsCentersTypes()
        //{
        //    return View(DB.TrainingsCentersTypes);
        //}

        //public ActionResult TrainingsCentersTypesPartial()
        //{
        //    return PartialView("TrainingsCentersTypesPartial", DB.TrainingsCentersTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsCentersTypesPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsCentersTypes trainingsCentersTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsCentersTypesUpdate(trainingsCentersTypeItem);
        //    }
        //    return PartialView("TrainingsCentersTypesPartial", DB.TrainingsCentersTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsCentersTypesPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsCentersTypes trainingsCentersTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsCentersTypesDelete(trainingsCentersTypeItem);
        //    }
        //    return PartialView("TrainingsCentersTypesPartial", DB.TrainingsCentersTypes);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsCentersTypesPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsCentersTypes trainingsCentersTypeItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsCentersTypesInsert(trainingsCentersTypeItem);
        //    }
        //    return PartialView("TrainingsCentersTypesPartial", DB.TrainingsCentersTypes);
        //}

        //#endregion

        //#region TrainingsTrainers

        //[CheckAccessAttribute]
        //public ActionResult TrainingsTrainers()
        //{
        //    return View(DB.TrainingsTrainers);
        //}

        //public ActionResult TrainingsTrainersPartial()
        //{
        //    return PartialView("TrainingsTrainersPartial", DB.TrainingsTrainers);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsTrainersPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsTrainers trainingsTrainerItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsTrainersUpdate(trainingsTrainerItem);
        //    }
        //    return PartialView("TrainingsTrainersPartial", DB.TrainingsTrainers);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsTrainersPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsTrainers trainingsTrainerItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsTrainersDelete(trainingsTrainerItem);
        //    }
        //    return PartialView("TrainingsTrainersPartial", DB.TrainingsTrainers);
        //}

        //[HttpPost, ValidateInput(false)]
        //public ActionResult TrainingsTrainersPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] TrainingsTrainers trainingsTrainerItem)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        DB.TrainingsTrainersInsert(trainingsTrainerItem);
        //    }
        //    return PartialView("TrainingsTrainersPartial", DB.TrainingsTrainers);
        //}

        //#endregion

        //#region DBReload

        //public ActionResult DBReload()
        //{
        //    DB.Entities = null;
        //    return View();
        //}

        //#endregion

        #region Configurations - moved

        [CheckAccessAttribute]
        public ActionResult Configurations()
        {
            var confCol = new CRM.Database.Model.ConfigurationsCollection();
            return View(confCol.ConfigurationsList);
            //return View(DB.Configurations);
        }

        public ActionResult ConfigurationsPartial()
        {
            var confCol = new CRM.Database.Model.ConfigurationsCollection();
            return PartialView("ConfigurationsPartial", confCol.ConfigurationsList);
            //return PartialView("ConfigurationsPartial", DB.Configurations);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ConfigurationsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Configurations configurationItem)
        {
            var confCol = new CRM.Database.Model.ConfigurationsCollection();
            if (ModelState.IsValid)
            {
                confCol.Update(configurationItem, Request.LogonUserIdentity.Name);
                //DB.ConfigurationsUpdate(configurationItem);
            }
            return PartialView("ConfigurationsPartial", confCol.ConfigurationsList);
            //return PartialView("ConfigurationsPartial", DB.Configurations);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ConfigurationsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Configurations configurationItem)
        {
            var confCol = new CRM.Database.Model.ConfigurationsCollection();
            if (ModelState.IsValid)
            {
                confCol.Delete(configurationItem);
                //DB.ConfigurationsDelete(configurationItem);
            }
            return PartialView("ConfigurationsPartial", confCol.ConfigurationsList);
            //return PartialView("ConfigurationsPartial", DB.Configurations);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ConfigurationsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.Configurations configurationItem)
        {
            var confCol = new CRM.Database.Model.ConfigurationsCollection();
            if (ModelState.IsValid)
            {
                confCol.Add(configurationItem, Request.LogonUserIdentity.Name);
                //DB.ConfigurationsInsert(configurationItem);
            }
            return PartialView("ConfigurationsPartial", confCol.ConfigurationsList);
            //return PartialView("ConfigurationsPartial", DB.Configurations);
        }

        #endregion


        #region ProfineEssentialElements

        public ActionResult ProfineEssentialElements()
        {
            var col = new ProfineEssentialElementsCollection();
            return View(col.ProfineEssentialElementsList);
        }


        public ActionResult ProfineEssentialElementsPartial()
        {
            var col = new ProfineEssentialElementsCollection();
            return PartialView("ProfineEssentialElementsPartial", col.ProfineEssentialElementsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProfineEssentialElementsPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProfineEssentialElements peeItem)
        {
            var col = new ProfineEssentialElementsCollection();
            if (ModelState.IsValid)
            {
                col.Update(peeItem,Request.LogonUserIdentity.Name);
               }
            return PartialView("ProfineEssentialElementsPartial", col.ProfineEssentialElementsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProfineEssentialElementsPartialAdd([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProfineEssentialElements peeItem)
        {
            var col = new ProfineEssentialElementsCollection();
            if (ModelState.IsValid)
            {
                col.Add(peeItem, Request.LogonUserIdentity.Name);
            }
            return PartialView("ProfineEssentialElementsPartial", col.ProfineEssentialElementsList);
        }

        [HttpPost, ValidateInput(false)]
        public ActionResult ProfineEssentialElementsPartialDelete([ModelBinder(typeof(DevExpressEditorsBinder))] CRM.Database.Model.ProfineEssentialElements peeItem)
        {
            var col = new ProfineEssentialElementsCollection();
            if (ModelState.IsValid)
            {
                col.Delete(peeItem);
            }
            return PartialView("ProfineEssentialElementsPartial", col.ProfineEssentialElementsList);
        }
#endregion
    }
}
